import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/admin/system/index/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/admin/system/index/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/admin/system/index/logout',
    method: 'post'
  })
}


 /*
  获取岗位列表
  */
  export function getPostList(sysUserVO) {
    return request({
      url: '/sysUser/getUserList/',
      method: 'get',
      params:sysUserVO
    })
  }

 /*
  增加用户
  */
  export function addUser(data) {
    return request({
      url: '/sysUser/addUser',
      method: 'post',
      data:data
    })
  }  

   /*
  更新用户
  */
  export function updateUser(data) {
    return request({
      url: '/sysUser/updateUser',
      method: 'put',
      data:data
    })
  } 

  /*
  获得用户信息
  */
  export function getUserById(userId) {
    return request({
      url: '/sysUser/getUserById/'+userId,
      method: 'get'
    })
  }

    /*
  修改用户信息状态
  */
  export function updateUserStatus(data) {
    return request({
      url: '/sysUser/updateUserStatus',
      method: 'put',
      data:data
    })
  }

  // /*
  // 重置密码
  // */
  // export function restPassWord(data) {
  //   return request({
  //     url: '/sysUser/restPassWord',
  //     method: 'put',
  //     data:data
  //   })
  // }

    /*
  重置密码
  */
  export function restPassWord(id,password) {
    const data = {
      id,
      password
    }
    return request({
      url: '/sysUser/restPassWord',
      method: 'put',
      data:data
    })
  }

  /*
  删除用户信息
  */
  export function deleteUserById(userId) {
    return request({
      url: '/sysUser/deleteUserById/'+userId,
      method: 'delete'
    })
  }

    /*
  批量删除用户信息
  */
  export function bachDeleteUser(ids) {
    return request({
      url: '/sysUser/bachDeleteUser/'+ids,
      method: 'delete'
    })
  }


